<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * Testcase filter form base class.
 *
 * @package    filters
 * @subpackage Testcase *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseTestcaseFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'estimateexecution' => new sfWidgetFormFilterInput(),
      'userid'            => new sfWidgetFormDoctrineChoice(array('model' => 'User', 'add_empty' => true)),
      'idcomponent'       => new sfWidgetFormDoctrineChoice(array('model' => 'Component', 'add_empty' => true)),
      'testsuitid'        => new sfWidgetFormDoctrineChoice(array('model' => 'Testsuite', 'add_empty' => true)),
      'title'             => new sfWidgetFormFilterInput(),
      'steps'             => new sfWidgetFormFilterInput(),
      'expectedresult'    => new sfWidgetFormFilterInput(),
      'applicable'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'estimateexecution' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'userid'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'User', 'column' => 'id')),
      'idcomponent'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Component', 'column' => 'id')),
      'testsuitid'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Testsuite', 'column' => 'id')),
      'title'             => new sfValidatorPass(array('required' => false)),
      'steps'             => new sfValidatorPass(array('required' => false)),
      'expectedresult'    => new sfValidatorPass(array('required' => false)),
      'applicable'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('testcase_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Testcase';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'estimateexecution' => 'Number',
      'userid'            => 'ForeignKey',
      'idcomponent'       => 'ForeignKey',
      'testsuitid'        => 'ForeignKey',
      'title'             => 'Text',
      'steps'             => 'Text',
      'expectedresult'    => 'Text',
      'applicable'        => 'Number',
    );
  }
}